<template>
  <div
    class=" pb-12 min-h-screen"
    style="min-width: 1200px;width: 1200px;margin:auto"
  >
    <div class=" py-4 bg-white ">
      <h2 class="text-xl pt-2 font-bold">
        江西省独角兽 | 瞪羚
      </h2>
      <h2 class="text-xl pt-2 font-bold">
        企业服务平台
      </h2>
    </div>
    <div class="flex justify-between py-2 mb-4  align-middle border-b">
      <span class="text-xl font-bold">
        政策列表
      </span>
      <div class="text-sm">
        当前位置:
        <router-link :to="{ path: '/' }" class="alink">
          首页
        </router-link>
        /
        <span>
          政策列表
        </span>
      </div>
    </div>
    <div>
      <div
        v-for="item in policyList"
        :key="item.annunciatePolicyId"
        class="flex justify-between py-3 border-b border-dashed cursor-pointer hover:bg-gray-100 alink"
        @click="toNoticeDetail(item.annunciatePolicyId)"
      >
        <h4 class="flex-grow-2 max-w-3xl h-4 truncate">
          {{ item.title }}
        </h4>
        <span
          class="not-italic text-gray-400 flex-grow-1 min-w-8rem text-right"
        >
          {{ item.publishTime }}
        </span>
      </div>
    </div>

    <pagination
      v-show="tableTotal > 0"
      :total="tableTotal"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getPolicyList } from "@/api/policy";
export default {
  name: "policyDetail",

  data() {
    return {
      tableTotal: 1,
      queryParams: {
        pageSize: 15,
        pageNum: 1
      },
      policyList: [
        {
          annunciatePolicyId: "",
          title: "",
          publishTime: "",
          content: ""
        }
      ]
    };
  },

  created() {
    // this.initId();
    // this.getList()
    this.getList();
  },
  methods: {
    getList() {
      let query = this.queryParams;
      getPolicyList(query).then(res => {
        this.tableTotal = res.total;
        this.policyList = res.rows;
      });
    },
    toPolicyDetail(id) {
      this.$router.push({ path: "/policyDetail", query: { id: id } });
    }
  }
};
</script>

<style></style>
